<?php
/**
 * Created by PhpStorm.
 * User: wangsentao
 * Date: 2018/1/30
 * Time: 上午11:16
 */

namespace app\platform\controller;

use app\common\ShaoHuoPay\Pay;

class Paytest
{
    protected $config;
    public $order;

    public function __construct()
    {
        $this->config = [
            'app_id' => config('pay')['ALI_PAY']['APPID'],
            'notify_url' => config('pay')['ALI_PAY']['notify_url'],
            'return_url' => '',
            'ali_public_key' => config('pay')['ALI_PAY']['ali_public_key'],
            'private_key' => config('pay')['ALI_PAY']['ali_private_key'],
            'mode' => 'dev', // optional,设置此参数，将进入沙箱模式
        ];
    }

    public function index()
    {
        $order = [
            'out_trade_no' => time(),
            'total_amount' => '1',
            'subject' => '极客 - 测试',
        ];

        $alipay = Pay::alipay($this->config)->app($order);

        return $alipay->send();
    }
}